Skip to main content

useStaging Hook

The useStaging hook provides access to and control over the staging and presentation-related state of the viewer. It is part of the @promaton/scan-viewer package and is implemented using the StagingStore interface.

Overview

The useStaging hook allows developers to manage various aspects of the viewer's state, such as slice positioning, coordinate systems, scene configurations, and more. Below is a detailed breakdown of its properties and methods.


Properties

centerSlicesOnPoint

Centers slices around a specific point.

centerSlicesOnPoint: (point: Vector3Tuple, orientation?: ViewOrientation, useSceneSize?: boolean) => void
  • Parameters:
    • point: The point to center slices on.
    • orientation?: Optional. The plane to apply the centering.
    • useSceneSize?: Optional. Use scene size instead of scan size for positioning.
  • Returns: void

coordinateSystem

The coordinate system used by the viewer.

coordinateSystem: CoordinateSystem;

customSliceMatrix

Matrix transform for a custom slice.

customSliceMatrix: Matrix4;

customSliceTarget

Defines camera behavior for the ViewOrientation.CUSTOM view.

customSliceTarget: CustomSliceTarget;

getSliceSize

Gets the size, origin, and spacing of the image volume.

getSliceSize: (imageVisible: boolean) => ScanSize;
  • Parameters:
    • imageVisible: Whether the image is visible.
  • Returns: ScanSize

lastSceneChange

Timestamp of the last scene change.

lastSceneChange: number;

lookTarget

The look direction of the last camera animation.

lookTarget: Vector3Tuple;

notifySceneChanged

Notifies observers of a scene change.

notifySceneChanged: () => void
  • Returns: void

panoramaConfig

Configuration for the panorama view.

panoramaConfig: PanoramaConfig;

scanSize

Size of the 3D scan image.

scanSize: ScanSize;

sceneCenter

Center of the bounding box around all scene objects.

sceneCenter: Vector3Tuple;

sceneSize

Diameter of the scene, used for camera animations.

sceneSize: number;

sliceExposure

Brightness and contrast settings for image data.

sliceExposure: Exposure;

slicePlaneSpringEnabled

Indicates if the spring effect is enabled for slice plane updates.

slicePlaneSpringEnabled: boolean;

slices

Position of orthogonal image slices (range 0-1).

slices: {
AXI: number,
COR: number,
SAG: number,
CUSTOM: number,
PANO: number
}

Methods

setCoordinateSystem

Updates the coordinate system.

setCoordinateSystem: (system: CoordinateSystem) => void

setCustomSliceMatrix

Updates the custom slice transform.

setCustomSliceMatrix: (matrix: Matrix4) => void

setCustomSliceTarget

Updates the custom slice target.

setCustomSliceTarget: (target: CustomSliceTarget) => void

setPanoramaConfig

Updates the panorama configuration.

setPanoramaConfig: (config: Partial<PanoramaConfig>) => void

setScanSize

Updates the scan size.

setScanSize: (size: ScanSize) => void

setSceneCenter

Updates the scene center.

setSceneCenter: (center: Vector3Tuple) => void

setSceneSize

Updates the scene size.

setSceneSize: (scale: number) => void

setSlice

Updates the fractional slice position for a given orientation.

setSlice: (orientation: AXI | COR | SAG | CUSTOM | PANO, slice: number, opts?: { springEnabled?: boolean }) => void

setSliceExposure

Updates the exposure settings.

setSliceExposure: (style: Partial<Exposure>) => void

getPanoramaEnabled

Checks if the panorama feature is enabled.

getPanoramaEnabled: () => boolean;
  • Returns: boolean

Conclusion

The useStaging hook is a powerful tool for managing the state of the viewer, providing fine-grained control over slices, scenes, and configurations. By leveraging its properties and methods, developers can create dynamic and interactive viewer experiences.